package com.yyq.eduservice.controller;


import com.yyq.eduservice.entity.subjectTree.firSubjectPoint;
import com.yyq.eduservice.service.EduSubjectService;
import com.yyq.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author yyq
 * @since 2021-04-14
 */
@CrossOrigin
@RestController
@RequestMapping("/eduservice/subject")
public class EduSubjectController {
    @Autowired
    private EduSubjectService subjectService;

    @PostMapping("upSubject")
    public R subjectUpload(MultipartFile file){
        subjectService.upSubjectFile(file,subjectService);
        return R.ok();
    }

    @GetMapping("getSubList")
    public R getSubjectList(){
        List<firSubjectPoint> list=new ArrayList<>();
           list=subjectService.getSubjectList();
        return R.ok().data("list",list);
    }

}

